package com.funquer.cms.model;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-3-17
 * Time: 上午10:19
 * To change this template use File | Settings | File Templates.
 */
@Table(name = "channeltype")
@Entity
@JsonIgnoreProperties(value={"arcTypes"})
public class ChanneltypeEntity  implements Serializable {
    private String id;

    @Column(name = "id", nullable = false, insertable = true, updatable = true, length = 50, precision = 0)
    @Id
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }




    private String nid;

    @Column(name = "nid", nullable = false, insertable = true, updatable = true, length = 20, precision = 0)
    @Basic
    public String getNid() {
        return nid;
    }

    public void setNid(String nid) {
        this.nid = nid;
    }

    private String typename;

    @Column(name = "typename", nullable = false, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getTypename() {
        return typename;
    }

    public void setTypename(String typename) {
        this.typename = typename;
    }

    private short issystem;

    @Column(name = "issystem", nullable = false, insertable = true, updatable = true, length = 5, precision = 0)
    @Basic
    public short getIssystem() {
        return issystem;
    }

    public void setIssystem(short issystem) {
        this.issystem = issystem;
    }

    private short isshow;

    @Column(name = "isshow", nullable = false, insertable = true, updatable = true, length = 5, precision = 0)
    @Basic
    public short getIsshow() {
        return isshow;
    }

    public void setIsshow(short isshow) {
        this.isshow = isshow;
    }

    //是否支持会员投稿
    private short issend;

    @Column(name = "issend", nullable = false, insertable = true, updatable = true, length = 5, precision = 0)
    @Basic
    public short getIssend() {
        return issend;
    }

    public void setIssend(short issend) {
        this.issend = issend;
    }

    //会员许可投稿级别
    private short sendrank;

    @Column(name = "sendrank", nullable = false, insertable = true, updatable = true, length = 5, precision = 0)
    @Basic
    public short getSendrank() {
        return sendrank;
    }

    public void setSendrank(short sendrank) {
        this.sendrank = sendrank;
    }


    //许可投稿会员组
    private Integer usertype;

    @Column(name = "usertype", nullable = false, insertable = true, updatable = true, length = 11, precision = 0)
    @Basic
    public Integer getUsertype() {
        return usertype;
    }

    public void setUsertype(Integer usertype) {
        this.usertype = usertype;
    }




    //会员稿件默认状态
    private short arcsta;

    @Column(name = "arcsta", nullable = false, insertable = true, updatable = true, length = 5, precision = 0)
    @Basic
    public short getArcsta() {
        return arcsta;
    }

    public void setArcsta(short arcsta) {
        this.arcsta = arcsta;
    }

    private String remark;

    @Column(name = "remark", nullable = false, insertable = true, updatable = true, length = 255, precision = 0)
    @Basic
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ChanneltypeEntity that = (ChanneltypeEntity) o;

        if (arcsta != that.arcsta) return false;
        if (id != that.id) return false;
        if (issend != that.issend) return false;
        if (isshow != that.isshow) return false;
        if (issystem != that.issystem) return false;
        if (sendrank != that.sendrank) return false;
        if (nid != null ? !nid.equals(that.nid) : that.nid != null) return false;
        if (typename != null ? !typename.equals(that.typename) : that.typename != null) return false;
        if (usertype != null ? !usertype.equals(that.usertype) : that.usertype != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = 0;
        result = 31 * result + (nid != null ? nid.hashCode() : 0);
        result = 31 * result + (typename != null ? typename.hashCode() : 0);
        result = 31 * result + (int) issystem;
        result = 31 * result + (int) isshow;
        result = 31 * result + (int) issend;
        result = 31 * result + (int) arcsta;
        result = 31 * result + (usertype != null ? usertype.hashCode() : 0);
        result = 31 * result + (int) sendrank;
        return result;
    }



    private Set<ArctypeEntity> arcTypes;


    @OneToMany(mappedBy = "channalTypeRef",fetch = FetchType.LAZY,cascade = CascadeType.ALL)
    public Set<ArctypeEntity> getArcTypes() {
        return arcTypes;
    }

    public void setArcTypes(Set<ArctypeEntity> arcTypes) {
        this.arcTypes = arcTypes;
    }
}
